package service

import (
	"catering_sys_api/cmd/api/biz/business/model/user"
	"catering_sys_api/cmd/api/dao"
	"context"

	"github.com/cloudwego/hertz/pkg/app"
)

type UserService struct {
	ctx context.Context
	c   *app.RequestContext
}

func NewUserService(ctx context.Context, c *app.RequestContext) *UserService {
	return &UserService{
		ctx: ctx,
		c:   c,
	}
}

func (p *UserService) Get() (response user.GetResponse, err error) {
	var (
		businessUserDao *dao.BusinessUserDao
		businessUserVo  dao.BusinessUserVo
	)

	businessUserVo, err = businessUserDao.GetBusinessUserVoFromC(p.c)
	if err != nil {
		return
	}

	response.UserId = businessUserVo.UserId
	response.RealName = businessUserVo.RealName
	response.Phone = businessUserVo.Phone
	response.BusinessID = businessUserVo.BusinessID
	response.BusinessName = businessUserVo.BusinessName
	response.StartTime = businessUserVo.StartTime
	response.EndTime = businessUserVo.EndTime
	return
}
